home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 504 < prev    next >
Text File  |  1996-08-06  |  2KB  |  70 lines

  1. Newsgroups: comp.sys.hp.hpux,comp.std.c,comp.lang.c
  2. Path: news.sprintlink.net!news!devil
  3. From: devil@tpoint.net (The Devil Himself)
  4. Subject: struct init problem
  5. Message-ID: <DnrAEx.HA@tpoint.net>
  6. Followup-To: poster
  7. Reply-To: devil@tpoint.net
  8. Organization: Not Hardly!
  9. Distribution: na
  10. Date: Mon, 4 Mar 1996 18:37:45 GMT
  11.  
  12. I found that the attached code does not compile on HP's, but does compile on
  13. UNIXware, etc. I'd like to hear any ideas beside my hacked solution.
  14. I'm looking for a way to preserve using the struct = { .... } syntax.
  15.  
  16. Also, who you characterize this problem vs. ansi C.....
  17.  
  18. E-mail answers please....
  19. Thanks - D
  20.  
  21. _+_+_+_+_+_+_ problem code _+_+_+_+
  22.  
  23. struct testme
  24. {
  25.     int     dum_huh ;
  26.     int *    p ;
  27. } ;
  28. void foofunk( void ) 
  29. {
  30.  
  31.     int     ima_int = 0xdeadbeef ;
  32.     {
  33.         struct test_me please = 
  34.         {
  35.             0xbeefdead ,
  36.             & ima_int 
  37.         } ;
  38.  
  39.     /*
  40.      * NOTE: HP-UX foo A.09.05 A 9000/712
  41.      * wont compile this & ima_int statement, unless I declare
  42.      * BOTH ima_int AND please as "static". unfortunately, I want this
  43.      * code to be reenterant.
  44.      */
  45.  
  46.     }
  47.     /* whatever */
  48. }
  49. _+_+_+_+_+_+ hack solution _+_+_+_+_+
  50. void foofunk( void ) 
  51. {
  52.  
  53.     int     ima_int = 0xdeadbeef ;
  54.     {
  55.         struct test_me please = 
  56.         {
  57.             0xbeefdead ,
  58.         } ;
  59.  
  60.         please . p = & ima_int 
  61.         /* whatever */
  62.     }
  63.     /* whatever */
  64. }
  65. -- 
  66. .... (C) 1995 Copyright Duncan Idaho, All Rights Reserved ..................
  67. There are "three absolute rights [sic] the right of personal security, personal
  68. liberty and personal property," Sir William Blackstone.  "The protection of
  69. these faculties is the first object of government." Madison, Federalist 10.
  70.